﻿namespace FrontEnd.Views
{
	using System;
	using System.Threading;
	using System.Web.Mvc;

	public static class ScriptPageExtensions
	{
		public static string JqueryValidateLocalizationScript(this ViewMasterPage masterPage)
		{
			switch (Thread.CurrentThread.CurrentUICulture.Name.ToLowerInvariant())
			{
				case "uk-ua":
					return JqueryValidateLocalizationScript(masterPage, "ua");
				case "tu-ru":
					return JqueryValidateLocalizationScript(masterPage, "ru");
			}

			return String.Empty;
		}

		private static string JqueryValidateLocalizationScript(ViewMasterPage masterPage, string sufix)
		{
			return "<script type=\"text/javascript\" src=\"../../Scripts/jquery.validate.localization/messages_" + sufix + ".js\"></script>";
		}
	}
}
